package br.com.intelsys.utils.basics.webbrowser;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.httpclient.Cookie;

public class IWebResponse {

	private final IWebRequest iWebRequest;
	private String responseContent;
	private Map<String, List<String>> headerMap;
	private Map<String, Cookie> cookieMap;

	IWebResponse(IWebRequest iWebRequest) {
		this.iWebRequest = iWebRequest;
	}

	public IWebRequest getiWebRequest() {
		return iWebRequest;
	}

	public String getResponseContent() {
		return responseContent;
	}

	void setResponseContent(String responseContent) {
		this.responseContent = responseContent;
	}

	public Map<String, List<String>> getHeaderMap() {
		return headerMap;
	}

	void setHeaderMap(Map<String, List<String>> headerMap) {
		this.headerMap = headerMap;
	}

	public Map<String, Cookie> getCookieMap() {
		return cookieMap;
	}

	void addCookie(Cookie cookie) {
		if (cookie != null && cookie.getName() != null) {
			if (cookieMap == null) {
				cookieMap = new HashMap<String, Cookie>();
			}
			cookieMap.put(cookie.getName(), cookie);
		}
	}
}
